export interface CriPageI {
  criteria: Criteria;
  page: TurnablePage;
}
export class CriPage implements CriPageI {
  constructor(public criteria: CriteriaI, public page: TurnablePage) {}
}
export interface CriteriaI {
  criterions: CriterionI[];
  projections: ProjectionI[];
  orders: OrderI[];
}
export class Criteria implements CriteriaI {
  constructor(public criterions: CriterionI[] = [], public projections: ProjectionI[], public orders: OrderI[] = []) {}
}

export class TurnablePage {
  public start: number = 0;
  public length: number = 5;
  public count: number = 0;
}

export interface OrderI {
  sort: "asc" | "desc";
  property: string;
}
export class Order implements OrderI {
  constructor(public sort: "asc" | "desc", public property: string) {}
}

export interface CriterionI {
  op: "or" | "and" | "not" | "eq" | "like" | "gt" | "lt" | "in";
  property?: string;
  criterions?: CriterionI[];
  value?: any;
}
export interface ProjectionI {
  op?: string;
  property: string;
}

export class ComplexCriterion implements CriterionI {
  constructor(public op: "or" | "and" | "not", public criterions: CriterionI[]) {}
}

export class SimpleCriterion implements CriterionI {
  constructor(public op: "eq" | "like" | "gt" | "lt", public property: string, public value: string | number | boolean | null = null) {}
}
